#include <bits/stdc++.h>
using namespace std;

class Solution
{
public:
    int main()
    {
        int L;
        cin >> L;
        int sum = 0;
        int n = 2;
        int count = 0;
        while (true)
        {
            if (IsPrime(n))
            {
                if (sum + n <= L)
                {
                    sum += n;
                    ++count;
                    cout << n << endl;
                }
                else
                {
                    break;
                }
            }
            ++n;
        }
        cout << count;
        return 0;
    }

    static bool IsPrime(int n)
    {
        int upperBound = sqrt(n);
        for (int i = 2; i <= upperBound; ++i)
        {
            if (n % i == 0)
            {
                return false;
            }
        }
        return true;
    }
};

#ifndef __LOCAL_TEST__
int main()
{
    return Solution().main();
}
#endif